package com.multi.thread.chapter01;

/**
 *	不共享数据线程
 */
public class DonotShareThread extends Thread {
	
	private int count = 5;

	public DonotShareThread(String name) {
		super();
		this.setName(name);
	}

	@Override
	public void run() {
		super.run();
		while (count > 0) {
			count--;
			System.out.println("由 " + Thread.currentThread().getName() + " 计算, count = " + count);
		}
	}
	
	public static void main(String[] args) {
		DonotShareThread threadA = new DonotShareThread("A");
		DonotShareThread threadB = new DonotShareThread("B");
		DonotShareThread threadC = new DonotShareThread("C");
		threadA.start();
		threadB.start();
		threadC.start();
	}

}
